<template>
  <q-page class="cc-admin">

    <div class="col bg-white shadow-2 q-pa-md q-ma-sm">
      <q-table flat color="primary" class="cross_table" separator="cell" :columns="columns" :data="list" row-key="id" :pagination.sync="pagination" :visible-columns="group" @request="query" :rows-per-page-options="[10, 20, 50, 100]" selection="multiple" :selected.sync="selected">

        <!-- <template v-slot:top="table">
          <div class="row no-wrap full-width">
            <q-input clearable outlined dense placeholder="请输入关键字搜索" class="on-left" @input="query" debounce="500" v-model="key">
              <template #append>
                <q-btn flat round icon="search" color="primary" @click="query" :loading="loading">
                  <q-tooltip>搜索</q-tooltip>
                </q-btn>
              </template>
</q-input>
<q-space />
<table-top-btns label="海洋天气情况"
                modelName="seaConditions"
                :showAdd="true"
                :table="table"
                :selected="selected"
                :importing="importing"
                :exporting="exporting"
                :importExcelUrlFull="importExcelUrlFull"
                :columns="columns"
                @groupChange="groupChange"
                @add="add"
                @importExcel="importExcel"
                @exportExcel="exportExcel"
                @showConfirm="showConfirm" />
</div>
</template> -->
        <template #body-cell-opt="props">
          <q-td :props="props" :auto-width="true">
            <q-btn flat round dense color="primary" icon="edit" @click="edit(props.row)"> <q-tooltip>编辑</q-tooltip></q-btn>
            <q-btn flat round dense color="primary" icon="mdi-content-copy" @click="copy(props.row)">
              <q-tooltip>复制</q-tooltip>
            </q-btn>
            <btn-del label="海洋天气情况" @confirm="del(props.row)" />
          </q-td>
        </template>
      </q-table>
    </div>
    <q-dialog maximized flat persistent ref="dialog">
      <q-form @submit="submit" class="dialog_card column">
        <h5 class="view_title justify-between q-px-md">
          {{ editType }}海洋天气情况
          <q-btn dense outline round icon="clear" size="sm" v-close-popup />
        </h5>
        <q-scroll-area class="col">
          <div class="row q-col-gutter-x-md dialog_form q-pa-md">
            <!-- <div class="col-12">
              <h5> 编号：</h5>
              <q-input outlined dense v-model="form.id" type="text" />
            </div>-->
            <div class="col-12">
              <h5> 平台id：</h5>
              <q-input outlined dense v-model="form.platformId" type="text" />
            </div>
            <div class="col-12">
              <h5> 城市名：</h5>
              <q-input outlined dense v-model="form.cityName" type="text" />
            </div>
            <div class="col-12">
              <h5> 经度：</h5>
              <q-input outlined dense v-model="form.lon" type="text" />
            </div>
            <div class="col-12">
              <h5> 纬度：</h5>
              <q-input outlined dense v-model="form.lat" type="text" />
            </div>
            <div class="col-12">
              <h5> 更新时刻：</h5>
              <q-input outlined dense v-model="form.dateTime" type="text" />
            </div>
            <div class="col-12">
              <h5> 白天或夜晚：</h5>
              <q-input outlined dense v-model="form.pod" type="text" />
            </div>
            <div class="col-12">
              <h5> 能见度：</h5>
              <q-input outlined dense v-model="form.visibility" type="text" />
            </div>
            <div class="col-12">
              <h5> 天气：</h5>
              <q-input outlined dense v-model="form.weatherDescription" type="text" />
            </div>
            <div class="col-12">
              <h5> 天气代码：</h5>
              <q-input outlined dense v-model="form.weatherCode" type="text" />
            </div>
            <div class="col-12">
              <h5> 云层量：</h5>
              <q-input outlined dense v-model="form.clouds" type="text" />
            </div>
            <div class="col-12">
              <h5> 气压：</h5>
              <q-input outlined dense v-model="form.pressure" type="text" />
            </div>
            <div class="col-12">
              <h5> 降雨量：</h5>
              <q-input outlined dense v-model="form.precipitation" type="text" />
            </div>
            <div class="col-12">
              <h5> 降雪量：</h5>
              <q-input outlined dense v-model="form.snow" type="text" />
            </div>
            <div class="col-12">
              <h5> 温度：</h5>
              <q-input outlined dense v-model="form.temperature" type="text" />
            </div>
            <div class="col-12">
              <h5> 体感温度：</h5>
              <q-input outlined dense v-model="form.appTemp" type="text" />
            </div>
            <div class="col-12">
              <h5> 紫外线指数：</h5>
              <q-input outlined dense v-model="form.ultravioletRays" type="text" />
            </div>
            <div class="col-12">
              <h5> 相对湿度：</h5>
              <q-input outlined dense v-model="form.rHumidity" type="text" />
            </div>
            <div class="col-12">
              <h5> 风向角度：</h5>
              <q-input outlined dense v-model="form.windDirection" type="text" />
            </div>
            <div class="col-12">
              <h5> 风速：</h5>
              <q-input outlined dense v-model="form.windSpeed" type="text" />
            </div>
            <div class="col-12">
              <h5> 风向：</h5>
              <q-input outlined dense v-model="form.windMark" type="text" />
            </div>
            <!-- <div class="col-12">
              <h5> 公司id：</h5>
              <q-input outlined dense v-model="form.tenantId" type="text" />
            </div> -->
          </div>
        </q-scroll-area>
        <div class="row justify-center q-pa-md">
          <q-btn outline color="primary" icon="mdi-close-thick" label="关闭" v-close-popup />
          <q-btn class="q-mx-md" color="primary" icon="mdi-check-bold" label="提交" :loading="loading" type="submit" />
        </div>
      </q-form>
    </q-dialog>
    <confirm ref="confirmDialog" :msg="confirmMsg" @confirm="deleteBatch()" />
    <q-inner-loading :showing="loading">
      <q-spinner-gears size="50px" color="primary" />
    </q-inner-loading>
  </q-page>
</template>

<script>
import { IndexMixin } from 'boot/mixins';
import { getDictLabel } from 'boot/dictionary';
import confirm from 'components/confirm';

export default {
  name: 'WeaSeaConditions',
  mixins: [IndexMixin],
  components: {
    confirm,
  },
  data() {
    return {
      columns: [
        {
          name: 'index',
          align: 'center',
          label: '序号',
          field: 'index',
        },
        // {
        //   name: 'id', align: 'left', label: '编号', field: 'id',
        // },
        // {
        //   name: 'platformId', align: 'left', label: '平台id', field: 'platformId',
        // },
        {
          name: 'platformIdText', align: 'left', label: '平台名称', field: 'platformIdText',
        },
        {
          name: 'cityName', align: 'left', label: '城市名', field: 'cityName',
        },
        {
          name: 'lon', align: 'left', label: '经度', field: 'lon',
        },
        {
          name: 'lat', align: 'left', label: '纬度', field: 'lat',
        },
        {
          name: 'dateTime', align: 'left', label: '更新时刻', field: 'dateTime',
        },
        {
          name: 'pod', align: 'left', label: '白天或夜晚', field: 'pod',
        },
        {
          name: 'visibility', align: 'left', label: '能见度', field: 'visibility',
        },
        {
          name: 'weatherDescription', align: 'left', label: '天气', field: 'weatherDescription',
        },
        {
          name: 'weatherCode', align: 'left', label: '天气代码', field: 'weatherCode',
        },
        {
          name: 'clouds', align: 'left', label: '云层量', field: 'clouds',
        },
        {
          name: 'pressure', align: 'left', label: '气压', field: 'pressure',
        },
        {
          name: 'precipitation', align: 'left', label: '降雨量', field: 'precipitation',
        },
        {
          name: 'snow', align: 'left', label: '降雪量', field: 'snow',
        },
        {
          name: 'temperature', align: 'left', label: '温度', field: 'temperature',
        },
        {
          name: 'appTemp', align: 'left', label: '体感温度', field: 'appTemp',
        },
        {
          name: 'ultravioletRays', align: 'left', label: '紫外线指数', field: 'ultravioletRays',
        },
        {
          name: 'rhumidity', align: 'left', label: '相对湿度', field: 'rhumidity',
        },
        {
          name: 'windDirection', align: 'left', label: '风向角度', field: 'windDirection',
        },
        {
          name: 'windSpeed', align: 'left', label: '风速', field: 'windSpeed',
        },
        {
          name: 'windMark', align: 'left', label: '风向', field: 'windMark',
        },
        // {
        //   name: 'tenantId', align: 'left', label: '公司id', field: 'tenantId',
        // },
        // {
        //   name: 'opt', align: 'center', label: '操作', field: 'id',
        // },
      ],
      showQuery: true,
      headers: [{ name: 'Authorization', value: localStorage.Authorization }],
      uploadUrl: `${process.env.SERVER_URL}${process.env.BASE_URL}/sys/common/upload`,
      imgUrl: `${process.env.SERVER_URL}${process.env.BASE_URL}/sys/common/static`,
      url: {
        list: '/wea/seaConditions/list',
        add: '/wea/seaConditions/add',
        edit: '/wea/seaConditions/edit',
        copy:
          '/wea/seaConditions/copy',
        delete: '/wea/seaConditions/delete',
        deleteBatch: '/wea/seaConditions/deleteBatch',
        exportXlsUrl: '/wea/seaConditions/exportXls',
        importExcelUrl: '/wea/seaConditions/importExcel',
      },
    };
  },
  methods: {
    getDictLabel,
    initDict() {
    },
  },
  mounted() {
    this.initDict();
  },
};
</script>

<style lang="stylus">

</style>
